import { request } from "../utils/request.js";
export default {

    // 获取排片数据
    getSchedulesData: async ({ curPage, eachPage }) =>
        await request({
            type: "GET",  //获取数据时type类型为GET
            url: "/api/schedules/get",
            data: { curPage, eachPage }
        }),
    // 获取电影
    getMovie: async () =>
        await request({
            type: "GET",
            url: "/api/schedules/getMovie",
        }),
    // 获取影院
    getCinemas: async () =>
        await request({
            type: "GET",
            url: "/api/schedules/getCinemas"
        }),
    // 获取影院对应的放映厅
    getTheaters: async _id =>
        await request({
            type: "GET",
            url: `/api/schedules/getTheaters/${_id}`,
        }),

    // 新增排片
    addSchedules: async data =>
        await request({
            type: "POST",
            url: `/api/schedules/addSchedules`,
            data,
        }),

    // 删除排片
    removeSchedules: async _id =>
        await request({
            type: "DELETE",
            url: `/api/schedules/removeSchedules/${_id}`,
        }),

    // 获取排片的座位
    getSeatings: async _id =>
        await request({
            type: "GET",
            url: `api/schedules/getSeatings/${_id}`,
        }),


    //通过排片id找到整条数据
    sortmoviesData: async _id =>
        await request({
            type: "GET",
            url: `api/schedules/getsortmoviesData/${_id}`,
        }),

    // 新增订单
    addOrder: async shopSeatId =>
        await request({
            type: "POST",
            url: `api/schedules/addOrder`,
            data: shopSeatId,
        }),


    // 查询电影
    findMovie: async _id =>
        await request({
            type: "GET",
            url: `api/schedules/findMovie/${_id}`,
        }),

}
